<div class='wrap-chapter-list right-cont' ng-controller='ChapterList'>
	<div class='title'>章节列表({{courseInfo.name}})<i class='fa fa-spinner fa-spin' ng-if='loading'></i></div>
	<div class='content'>
		<div class='box-ops'>
			<button class='btn btn-primary' data-toggle='modal' data-target='.modal.chapter-add'>添加</button>
		</div>
		<div class='box-list'>
			<table class='table table-list'>
                <tr>
                    <td>序号 <span class='fa fa-sort'></span></td>
                    <td>名称<span class='fa fa-sort'></span></td>
                    <td>描述<span class='fa fa-sort'></span></td>
                    <td>PPT长度<span class='fa fa-sort'></span></td>
                    <td>音频时长<span class='fa fa-sort'></span></td>
                    <td>试听<span class='fa fa-sort'></span></td>
                    <td>操作<span class='fa fa-sort'></span></td>
                </tr>
                <tr ng-repeat='item in list'>
                    <td>{{item.id || '未知'}}</td>
                    <td>{{item.sim_name || '未知'}}</td>
                    <td>{{item.sim_decipt || '未知'}}</td>
                    <td>{{item.img_count || 0}}</td>
                    <td>{{item.time || 0}}``</td>
                    <td>{{item.try_text || '未知'}}</td>
                    <td>
                    	<button class='btn btn-primary btn-xs btn-w-xs' ng-click='edit(item.id)'>编辑</button>
                    	<button class='btn btn-danger btn-xs btn-w-xs' ng-click='delete(item.id)'>删除</button>
                    </td>
                </tr>
            </table>
		</div>
	</div>

	<!-- 章节添加模态窗 -->
    <div class='modal fade chapter-add'>
        <div class='modal-dialog'>
            <div class='modal-content' align='center'>
                <div class='modal-header'>
                    章节添加
                    <a class='close' data-dismiss='modal'>&times;</a>
                </div>
                <div class='modal-body'>
                    <table class='table-form'>
                        <tr>
                            <td class='td-label'>章节名称:</td>
                            <td colspan='3'>
                                <input type='text' class='form-control' ng-model='aChapter.name'>
                            </td>
                        </tr>
                        <tr>
                            <td class='td-label'>学习资料:</td>
                            <td colspan='3'>
                                <textarea ng-model='aChapter.attach' class='form-control' 
                                    placeholder='[{"name":"资料名称1", "url":"资料链接1"},{"name":"资料名称2", "url":"资料链接2"}]'>
                                </textarea>
                            </td>
                        </tr>
                        <tr>
                            <td class='td-label'>章节音频:</td>
                            <td>
                                <div class='box-upload'>
                                    <button class='btn btn-primary btn-upload-show'>上传</button>
                                    <button class='btn-upload' id='upload-mp3'></button>
                                </div>
                            </td>
                        	<td class='td-label'>是否试听:</td>
                            <td>
                            	<div class="box-radio">
                            		<input type="radio" ng-model='aChapter.is_try' value='1'>是
                            	</div>
                            	<div class="box-radio">
                            		<input type="radio" ng-model='aChapter.is_try' value='0'>否
                            	</div>
                            </td>
                        </tr>
                        <tr>
                        	<td class='td-label'>PPT图片:</td>
                        	<td colspan='3' style='position: relative;'>
                                <div class='box-upload upload-image'>
                                    <button class='btn btn-primary btn-upload-show'>上传</button>
                                    <button class='btn-upload' id='upload-add' style='padding-top: 50px;'></button>
                                </div>
                        		<div class='td-ppt'>
                        			<div class='box-ppt'>
                        				<img ng-src='{{img.path}}' 
                        					ng-repeat='img in aChapter.imgs track by $index' 
                        					ng-click='remove_img(img, "add")'>
                        			</div>
                        		</div>
                        		
                        	</td>
                        </tr>
                        <tr>
                        	<td class='td-label'>章节描述:</td>
                        	<td colspan='3'>
                        		<textarea ng-model='aChapter.decipt' class='form-control'></textarea>
                        	</td>
                        </tr>
                    </table>
                </div>
                <div class='modal-footer'>
                    <button class='btn btn-primary btn-sm btn-w-sm' ng-click='add()'>确认</button>
                    <button class='btn btn-default btn-sm btn-w-sm' data-dismiss='modal'>取消</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 章节编辑模态窗 -->
    <div class='modal fade chapter-edit'>
        <div class='modal-dialog'>
            <div class='modal-content' align='center'>
                <div class='modal-header'>
                    章节编辑
                    <a class='close' data-dismiss='modal'>&times;</a>
                </div>
                <div class='modal-body'>
                    <table class='table-form'>
                        <tr>
                            <td class='td-label'>章节名称:</td>
                            <td colspan='3'>
                                <input type='text' class='form-control' ng-model='eChapter.name'>
                            </td>
                        </tr>
                        <tr>
                            <td class='td-label'>学习资料:</td>
                            <td colspan='3'>
                                <textarea ng-model='eChapter.attach' class='form-control' 
                                    placeholder='[{"name":"资料名称1", "url":"资料链接1"},{"name":"资料名称2", "url":"资料链接2"}]'>
                                </textarea>
                            </td>
                        </tr>
                        <tr>
                        	
                        </tr>
                        <tr>
                            <td class='td-label'>章节音频:</td>
                            <td>
                            	<div class='box-upload'>
                                	<button class='btn btn-primary btn-upload-show'>上传</button>
                                	<button class='btn-upload' id='upload-edit-mp3'></button>
                                </div>
                            </td>
                            <td class='td-label'>是否试听:</td>
                            <td>
                                <div class="box-radio">
                                    <input type="radio" ng-model='eChapter.is_try' value='1'>是
                                </div>
                                <div class="box-radio">
                                    <input type="radio" ng-model='eChapter.is_try' value='0'>否
                                </div>
                            </td>
                        </tr>
                        <tr>
                        	<td class='td-label'>PPT图片:</td>
                        	<td colspan='3' style='position: relative;'>
                        		<div class='td-ppt'>
                        			<div class='box-ppt'>
                        				<img ng-src='{{img.path}}' 
                        					ng-repeat='img in eChapter.imgs track by $index' 
                        					ng-click='remove_img(img, "edit")'>
                        			</div>
                        		</div>
                        		<div class='box-upload upload-image'>
	                        		<button class='btn btn-primary btn-upload-show'>上传</button>
	                        		<button class='btn-upload' id='upload-edit'></button>
	                        	</div>
                        	</td>
                        </tr>
                        <tr>
                        	<td class='td-label'>章节描述:</td>
                        	<td colspan='3'>
                        		<textarea ng-model='eChapter.decipt' class='form-control'></textarea>
                        	</td>
                        </tr>
                    </table>
                </div>
                <div class='modal-footer'>
                    <button class='btn btn-primary btn-sm btn-w-sm' ng-click='save()'>确认</button>
                    <button class='btn btn-default btn-sm btn-w-sm' data-dismiss='modal'>取消</button>
                </div>
            </div>
        </div>
    </div>
</div>